#include #include using namespace std; void main() { //int - 4 byte whole number //float - 4 byte floating point number //double - 8 byte floating point number const double GRAVITY = 9.8; //constant double time = 0; double initialHeight; double currentHeight; double speed; cout << "Initial height for object to fall from? "; cin >> initialHeight; cout.precision(4); cout.setf(ios_base::fixed); currentHeight = initialHeight; int loopCounter = 100; while(currentHeight > 0) { speed = GRAVITY * time; currentHeight = initialHeight - (speed/2 * time); if(loopCounter == 100) { cout << setw(5) << time; cout << setw(10) << speed; cout << setw(10) << currentHeight << endl; loopCounter = 0; } loopCounter++; time = time + .0001; } cout << setw(5) << time; cout << setw(10) << speed; cout << setw(10) << currentHeight << endl; }